home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / utildsk / hdsleep.lha / HDSleep / Source / thomdos.c < prev   
C/C++ Source or Header  |  1995-12-01  |  1KB  |  57 lines

  1. #include<string.h>
  2. #include<proto/dos.h>
  3. #include<proto/icon.h>
  4. #include<proto/exec.h>
  5. #include<exec/types.h>
  6. #include<workbench/startup.h>
  7.  
  8. struct DiskObject *TTGetOurIcon(struct WBStartup *);
  9. void TTFreeOurIcon(struct DiskObject *);
  10. char *TTString(struct DiskObject *,char *, char *);
  11. LONG TTInt(struct DiskObject *,char *, LONG);
  12. int TTBool(struct DiskObject *,char *, BOOL);
  13.  
  14. /* Read tooltypes */
  15.  
  16. struct DiskObject *TTGetOurIcon(struct WBStartup *WBenchMsg)
  17. {
  18.     struct DiskObject *keyobj=NULL;
  19.  
  20.     if (WBenchMsg) keyobj = GetDiskObject(WBenchMsg->sm_ArgList->wa_Name);
  21.     return keyobj;
  22. }
  23.  
  24. void TTFreeOurIcon(struct DiskObject *keyobj)
  25. {
  26.     if (keyobj) FreeDiskObject(keyobj);
  27. }
  28.  
  29. char *TTString(struct DiskObject *keyobj,char *name2, char *def)
  30. {
  31.     char *what;
  32.     if (keyobj)
  33.         if (what = FindToolType(keyobj->do_ToolTypes, name2))
  34.             return what;
  35.     return def;
  36. }
  37.  
  38. LONG TTInt(struct DiskObject *keyobj,char *name2, LONG def)
  39. {
  40.     char *what;
  41.     if (keyobj)
  42.         if (what = FindToolType(keyobj->do_ToolTypes, name2))
  43.             StrToLong(what, &def);
  44.     return def;
  45. }
  46.  
  47. int TTBool(struct DiskObject *keyobj,char *name2, BOOL def)
  48. {
  49.     char    *s;
  50.  
  51.     s = TTString(keyobj,name2, def ? "YES" : "NO");
  52.  
  53.     return    ((stricmp(s, "YES") == 0) ||
  54.         (stricmp(s, "TRUE") == 0) ||
  55.         (stricmp(s, "ON") == 0)) ? TRUE : FALSE;
  56. }
  57.